﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace webapp4U.UI.Controls
{
    public partial class Product : System.Web.UI.UserControl
    {
        int CateID = -1;
        protected void Page_Load(object sender, EventArgs e)
        {
            CateID = Globals.GetIntFromQueryString("CateID");



            List<webapp4U.BOL.Category> obj = webapp4U.BOL.Category.GetCategoryByParentCateID(CateID);
            rptCategory.DataSource = obj;
            rptCategory.DataBind();
        }

        protected List<webapp4U.BOL.Products> GetItemsByCateID(int CateID)
        {
            List<webapp4U.BOL.Products> obj = webapp4U.BOL.Products.GetTopProduct(CateID);
            return obj;
        }

        protected string GetPrice(decimal UnitPrice)
        {
            if (UnitPrice > 0)
                return Formatter.FormatMoney(UnitPrice).ToString() + " VNĐ";
            else
                return ResourceManager.GetString("Product_Price_Lienhe");
        }

        protected string GetButtonAddToCart(Decimal UnitPrice)
        {
            if (UnitPrice > 0)
                if (Globals.LangVietNam())
                    return "<img src=" + Globals.ImagesUrl() + "AddToCart_nho.gif border=0 />";
                else
                    return "<img src=" + Globals.ImagesUrl() + "AddToCart_nho_en.gif border=0 />";
            return "";
        }

    }
}